package com.bus.controller;

import com.bus.entity.Task;
import com.bus.service.TaskService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
@RequestMapping("/bus/task")
public class TaskController {
    @Resource
    TaskService taskService;

    @RequestMapping("/allTask")
    @ResponseBody
    public List<Task> allTask(HttpServletRequest request){
        List<Task> list=taskService.SelectAll(Integer.valueOf(request.getParameter("userId")));
        for(Task t:list){
            t.setCreateTime(t.getCreateTime().substring(5,16));
        }
        return list;
    }
}
